<template>

  <div id="app">
    <img src="./assets/logo.png">
    <div>
      <router-link to="/home" tag="button" replace>点击跳转到首页</router-link>
      <router-link to="/about" tag="button" replace>点击跳转到关于</router-link>
      <!--      <router-link :to="'/user/'+userID" tag="button" replace>点击跳转到关于</router-link>-->
      <!--      <router-link :to="{path:'/profile',query:{name: 'cheese',age: 18,height: 188}}" tag="button">点击跳转到我的</router-link>-->

      <!--    <button @click="homeClick">首页</button>-->
      <!--    <button @click="aboutClick">关于</button>-->
      <button @click="userClick">用户</button>
      <button @click="profileClick">档案</button>
      <keep-alive>
        <router-view/>
      </keep-alive>
    </div>

  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      userID: 'cheese'
    }
  },
  computed: {
    userRouter() {
      return this.$route.params.name
    }
  },
  methods: {
    homeClick() {
      // if(this.$route.path !== '/home'){
      this.$router.push('/home');
      // }
    },
    aboutClick() {
      this.$router.push('/about')
    },
    userClick() {
      this.$router.push('/user/' + this.userID)
    },
    profileClick() {
      this.$router.push({
        path: '/profile',
        query: {
          name: 'cheese',
          age: 18,
          height: 188
        }
      })
    },

  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}

.active {
  color: #f00;
}
</style>
